<?php

require_once 'LoginView.php';
require_once 'TextStringOutput.php';

class ShopBasketView {
		
	const Price = "price";
	const deleteItem = "tabortfigur";
	const buyProducts = "buy";
	
	private $messageAddItem = "";
	public function DoShopBasket() {
		$this->messageAddItem="";
		
		$returnString = "";
		$returnString .="
		<div id='shopBasket'>
			<h3>Varukorgen</h3>
		<div id='ItemDiv'>
				".$this->writeAddedItem()."
		";
		$returnString .= "
		</div>
		</div>";
	
		return $returnString;
		
	}
	
	
	public function writeAddedItem () {
		$returnString = "";
		if(isset($_POST[ProductView::BuyButton])) {
			
		$returnString .="
				<div id='ItemNameDiv'>
					<h4>
						Figur:<p id='textStringShop'>".$_GET['figur']."</p>
					</h4>
				</div>
				<div id='ItemPriceDiv'>
					<h4>
						Pris:<p id='textStringShop'>".$_GET['price']."</p>
					</h4>
				</div>	
				<div id='deleteItem'>
					<a href='?". ShopBasketView::deleteItem ."=". ShopBasketView::deleteItem ."'/>Ta bort</a>
				</div>
				<p id='FinalBuy'>
					<form action='?finalbuy=finalbuy' method='post' class='buyButton'>
						<input type='submit' class='buyButton' value='Köp' name='" . ShopBasketView::buyProducts ."'/>
					</form>	
		";
		$returnString .= "
		";
		}
		
		else {
			$returnString.= "<p id='textStringShop'>Varukorgen är tom</p>";
		}
		
		return $returnString;
	}
	
	
}

